//package com.bs.config;
//
//import org.apache.flink.streaming.api.CheckpointingMode;
//import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
//import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
//import org.springframework.context.annotation.Configuration;
//
//import javax.annotation.PostConstruct;
//
///**
// * @author bingshao
// * @date 2022/11/3
// **/
//@Configuration
//public class CdcSqlConfig {
//
//    @PostConstruct
//    public void initSqlFlink() throws Exception {
//        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//        env.enableCheckpointing(60 * 1000L);
//        env.getCheckpointConfig().setCheckpointingMode(CheckpointingMode.EXACTLY_ONCE);
//        env.getCheckpointConfig().setMinPauseBetweenCheckpoints(30 * 1000L);
//        env.getCheckpointConfig().setCheckpointTimeout(60 * 2 * 1000L);
//        env.getCheckpointConfig().setMaxConcurrentCheckpoints(1);
////        env.getCheckpointConfig().setCheckpointStorage("file:///checkpoint");
//        StreamTableEnvironment ste = StreamTableEnvironment.create(env);
//        ste.executeSql(
//                "create table mysqluser( id bigint,name VARCHAR," +
//                        "    PRIMARY KEY (id) NOT ENFORCED" +
//                        ") WITH (" +
//                        " 'scan.incremental.snapshot.enabled' = 'false'," +
////                        " 'scan.startup.mode' = 'initial', "+
//                        " 'connector' = 'mysql-cdc'," +
//                        " 'hostname' = '110.42.233.197'," +
//                        " 'port' = '3306'," +
//                        " 'username' = 'root'," +
//                        " 'password' = 'bs1354361838'," +
//                        " 'database-name' = 'bingshao'," +
//                        " 'table-name' = 'user'" +
//                        ")"
//        );
//        ste.executeSql(
//                "create table mysqlorder( id bigint,user_id bigint,product_name VARCHAR," +
//                        "    PRIMARY KEY (id) NOT ENFORCED" +
//                        ") WITH (" +
//                        " 'scan.incremental.snapshot.enabled' = 'false'," +
//                        " 'connector' = 'mysql-cdc'," +
//                        " 'hostname' = '110.42.233.197'," +
//                        " 'port' = '3306'," +
//                        " 'username' = 'root'," +
//                        " 'password' = 'bs1354361838'," +
//                        " 'database-name' = 'bingshao'," +
//                        " 'table-name' = 'order'" +
//                        ")"
//        );
//
//        ste.executeSql(
//                "create table mysqlsink(" +
//                        "id bigint,name VARCHAR,product_name VARCHAR," +
//                        "    PRIMARY KEY (id) NOT ENFORCED" +
//                        ") WITH (" +
//                        "'connector' = 'jdbc'," +
//                        "'url' = 'jdbc:mysql://110.42.233.197:3306/bingshao?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai'," +
//                        "'username' = 'root'," +
//                        "'password' = 'bs1354361838'," +
//                        "'table-name' = 'target'," +
//                        "'driver' = 'com.mysql.cj.jdbc.Driver'" +
//                        ")"
//        );
//
//
//        ste.executeSql(
//                "insert into mysqlsink(id,name,product_name) select o.id,u.name,o.product_name from mysqlorder as o left join mysqluser as u on o.user_id=u.id"
//        );
//
//
//    }
//}
